package game;

public class Card {
	
	private String name;
	private String type;
	private int cost;
	private int power;
	private int toughness;
	private int damage; // use inheritance for this stuff
	private boolean tapped;
	private boolean trample;
	private boolean removeAtEndOfTurn;
	private boolean flying;
	private boolean hasBeenUnearthedAlready;
	private int unearthCost;
	private int bonusPower;
	private boolean hasHaste;
	private boolean summoningSick;
	private boolean canOnlyAttackWithOtherCreatures;
	private int kickerCost;
	private boolean hasKicker;
	private int damageWithKicker;
	private boolean sacLand;
	
	public Card(String name, String type, int cost) {
		this.name = name;
		this.type = type;
		this.cost = cost;
		this.trample = false;
		this.removeAtEndOfTurn = false;
		this.hasBeenUnearthedAlready = false;
		this.unearthCost = Integer.MAX_VALUE;
		this.bonusPower = 0;
		this.hasHaste = false;
		this.summoningSick = false; // only creatures without haste have summoning sickness
		this.canOnlyAttackWithOtherCreatures = false;
		this.kickerCost = 0;
		this.hasKicker = false;
		this.damageWithKicker = 0;
		this.sacLand = false;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public int getCost() {
		return cost;
	}

	public void setCost(int cost) {
		this.cost = cost;
	}

	public int getPower() {
		return power + bonusPower;
	}

	public void setPower(int power) {
		this.power = power;
	}

	public int getToughness() {
		return toughness;
	}

	public void setToughness(int toughness) {
		this.toughness = toughness;
	}

	public int getDamage() {
		return damage;
	}

	public void setDamage(int damage) {
		this.damage = damage;
	}

	public void untap() {
		tapped = false;		
	}
	
	public void tap() {
		if (tapped == false) {
			tapped = true;
		} else {
			System.out.println("Illegal play! Attempted to tap a tapped card!");
		}
	}

	public boolean isTapped() {
		return tapped;
	}

	public boolean isTrample() {
		return trample;
	}

	public void setTrample(boolean trample) {
		this.trample = trample;
	}

	public boolean isRemoveAtEndOfTurn() {
		return removeAtEndOfTurn;
	}

	public void setRemoveAtEndOfTurn(boolean removeAtEndOfTurn) {
		this.removeAtEndOfTurn = removeAtEndOfTurn;
	}

	public void setFlying(boolean b) {
		this.flying = true;		
	}
	
	public boolean isFlying() {
		return this.flying;
	}

	public boolean isHasBeenUnearthedAlready() {
		// TODO Auto-generated method stub
		return this.hasBeenUnearthedAlready;
	}
	
	public void setHasBeenUnearthedAlready(boolean value) {
		this.hasBeenUnearthedAlready = value;
	}

	public int getUnearthCost() {
		return unearthCost;
	}

	public void setUnearthCost(int unearthCost) {
		this.unearthCost = unearthCost;
	}

	public void addPowerUntilEndOfTurn(int i) {
		this.bonusPower += i;		
	}

	public void clearAllModifiers() {
		this.bonusPower = 0;
	}

	public boolean isHasHaste() {
		return hasHaste;
	}

	public void setHasHaste(boolean hasHaste) {
		this.hasHaste = hasHaste;
		if (hasHaste = true) {
			this.summoningSick = false;
		}
	}

	public boolean isSummoningSick() {
		return summoningSick;
	}

	public void setSummoningSick(boolean summoningSick) {
		this.summoningSick = summoningSick;
	}

	public boolean isCanOnlyAttackWithOtherCreatures() {
		return canOnlyAttackWithOtherCreatures;
	}

	public void setCanOnlyAttackWithOtherCreatures(
			boolean canOnlyAttackWithOtherCreatures) {
		this.canOnlyAttackWithOtherCreatures = canOnlyAttackWithOtherCreatures;
	}

	public int getCostWithKicker() {
		return this.cost + this.kickerCost;
	}

	/**
	 * 
	 * @return JUST the kicker cost. If you want the regular cost plus the kicker cost, use getCostWithKicker()
	 */
	public int getKickerCost() {
		return kickerCost;
	}

	/**
	 * remember to set hasKicker() !
	 * @param kickerCost
	 */
	public void setKickerCost(int kickerCost) {
		this.kickerCost = kickerCost;
	}

	public boolean isHasKicker() {
		return this.hasKicker;
	}
	
	/**
	 * remember to set the kicker cost!
	 * @param k
	 */
	public void setHasKicker(boolean k) {
		this.hasKicker = k;
	}

	public int getDamageWithKicker() {		
		return damageWithKicker;
	}
	
	/** 
	 * Remember to set hasKicker !
	 * @param damage
	 */
	public void setDamageWithKicker(int damage) {
		this.damageWithKicker = damage;
	}

	public boolean isSacLand() {
		return sacLand;
	}
	
	public void setSacLand(boolean sac) {
		this.sacLand = sac;
	}
	
	

}
